/*
 * @Descripttion:
 * @Author: hejiajun
 * @Date: 2021-08-14 10:52:36
 * @LastEditors: hejiajun
 * @LastEditTime: 2021-11-02 16:12:23
 */
const { NODE_ENV } = process.env;
const prodPlugins = [];

// 正式环境删除所有console
if (NODE_ENV === 'prd') prodPlugins.push('transform-remove-console');

// 此处默认使用ant-design-vue 如用其它框架请自行配置
// 按需加载ant-design-vue
prodPlugins.push(
    ['lodash'],
    [
        'import',
        {
            libraryName: 'ant-design-vue',
            libraryDirectory: 'es',
            style: true,
        },
    ] // `style: true` 会加载 less 文件
);

// ant-vue 兼容ie11
prodPlugins.push(['@babel/plugin-transform-runtime']);

module.exports = {
    presets: [
        '@vue/cli-plugin-babel/preset',
        [
            '@babel/preset-env',
            {
                corejs: {
                    version: 3,

                    proposals: true,
                },
                useBuiltIns: 'entry',
            },
        ],
    ],
    plugins: [...prodPlugins],
};
